﻿


using System;
using Demo.Domain;
using System.Data.Entity;

namespace Demo.Repository
{
    public class DemoContext : System.Data.Entity.DbContext
    {
        public DbSet<Demo.Domain.Action> Action { get; set; }
        public DbSet<Module> Module { get; set; }
        public DbSet<Role> Role { get; set; }
        public DbSet<RoleModule> RoleModule { get; set; }
        public DbSet<RoleModuleAction> RoleModuleAction { get; set; }
        public DbSet<User> User { get; set; }
        public DbSet<UserModule> UserModule { get; set; }
        public DbSet<UserModuleAction> UserModuleAction { get; set; }
        public DbSet<UserRole> UserRole { get; set; }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            modelBuilder.Configurations.Add(new ActionMapping())
                .Add(new ModuleMapping())
                .Add(new RoleMapping())
                .Add(new RoleModuleMapping())
                .Add(new RoleModuleActionMapping())
                .Add(new UserMapping())
                .Add(new UserModuleMapping())
                .Add(new UserModuleActionMapping())
                .Add(new UserRoleMapping());
            base.OnModelCreating(modelBuilder);
        }


    }
}
